package com.bleeth.fx.helper;

import cn.hutool.core.util.IdUtil;
import lombok.Data;

/**
 * @author ：Bleeth
 * @date ：2022-03-15
 * @description：
 */
@Data
public class TreeEntity<T> {

    public static final String ROOT_TYPE = "ROOT";

    public static final String DIR_TYPE = "DIR";

    public static final String ITEM_TYPE = "ITEM";

    private String icon;

    private String name;

    private String id;

    private String type;

    private T t;

    public static TreeEntity create(String name) {
        return create(name, DIR_TYPE);
    }

    public static String createUUID() {
        return IdUtil.fastUUID();
    }

    public static TreeEntity create(String name, String type) {
        TreeEntity treeEntity = new TreeEntity();
        treeEntity.setName(name);
        treeEntity.setType(type);
        treeEntity.setId(IdUtil.fastUUID());
        return treeEntity;
    }

    @Override
    public String toString() {
        return name;
    }

}
